
<div class="register-container">
	<div class="register">
		<div class="register-logo">
			<a href="/" title="妈咪街">
				<img src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/images/register_logo.png" alt="妈咪街" title="妈咪街">
			</a>
		</div>
		<div class="register-info">
			<div class="register-top">
				<h2>商家注册</h2>
				<p>注册妈咪街账号即可获得妈咪街无微不至的关爱与体验，如果您已拥有妈咪街账号，即可<a href="<?php echo $this->createUrl('login') ?>" title="妈咪街账号登陆">在此登录</a></p>
			</div>
			<div class="register-bottom">
				<form id="form" action="" method="post">
					<table>
						<tr>
							<td>
								<label for="" id="UserName" style="font-weight: bold;font-size: 14px;">会员名：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="text"  required="required" id="UserName" name="UserName">
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<label for="" id="Email" style="font-weight: bold;font-size: 14px;">邮箱：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="text"  required="required" id="Email" name="Email">
								</div>
							</td>
						</tr>
						<tr>
							<td>
								<label for="" id="" style="font-weight: bold;font-size: 14px;">手机：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="text"  required="required" id="Phone" name="Phone">
								</div>
							</td>
						</tr>
						<tr style="" id="phone_code">
							<td>
								<label for="" style="font-weight: bold;font-size:14px;">验证码：</label>
							</td>
							<td>
								<div class="register-bottom-common-short register-bottom-common">
									<input type="text"  name="phone_captcha" >
									<button id="snscode" style="position: absolute;top: 0px;left: 120px;width: 150px;height: 35px;">获取验证码</button>
								</div>

							</td>

						</tr>
						<tr>
							<td>
								<label for="" id="" style="font-weight: bold;font-size: 14px;">旺旺：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="text"  required="required" id="WangWang" name="WangWang">
								</div>
							</td>
						</tr>


						<tr>
							<td>
								<label for="" style="font-weight: bold;font-size:14px;">设置密码：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="Password" name="Password" id="Password" required="required">
								</div>
							</td>
							<td>
								<p class="register-bottom-con">密码长度6~16位</p>
							</td>
						</tr>
						<tr>
							<td>
								<label for="" style="font-weight: bold;font-size:14px;">确认密码：</label>
							</td>
							<td>
								<div class="register-bottom-common">
									<input type="password" required="required" name="Repassword" id="Repassword">
								</div>
							</td>
						</tr>




					</table>
					<input type="submit" value="立即注册" class="register-sub">
				</form>
								<p class="register-btm-declare">点击"立即注册"，即表示您同意并愿意遵守妈咪街的<a href="<?php echo $this->createUrl('/front/articles/index', array('id' => 362)) ?>">《服务条款》</a></p>
				<div class="register-bottom-bg"></div>
			</div>
		</div>
	</div>
</div>

<script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/ajaxForm.js"></script> 
<link rel="stylesheet" href="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog6/css/ui-dialog.css">
<script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog6/js/dialog-min.js"></script> 
<script type="text/javascript">
	var LOCK = false;

var wait = 60;  //60秒才能发送一次
if (getCookie("time") == null || getCookie("time") <= 0){
    setCookie("time",wait,wait);
}else if(getCookie("time") != wait)
{
    timeRef();
}

//计时器
function time(o) {
    
        if(!o)
            var o = document.getElementById("snscode");
        
        if(getCookie("time") == wait){
            var moblie = $('#Phone').val();
            $.getJSON('<?php echo $this->createUrl('sendcode') ?>',{moblie:moblie},function(data){
                if(data.status){
                    
                }else{
                    alert(data.info);
                }
            });
        }
    
        if (getCookie("time") == null || getCookie("time") <= 0) {
            o.removeAttribute("disabled");
            //o.value="免费获取验证码";
            $(o).html("免费获取验证码");

        } else {

            timeRef();
            
        }
}
//刷新按钮
function timeRef(){
    if(!o)
        var o = document.getElementById("snscode");
    waittime = getCookie("time");
    o.setAttribute("disabled", true);
    //o.value="重新发送(" + waittime + ")";
    $(o).html("重新发送(" + waittime + ")");
    waittime--;
    setCookie("time",waittime);
    setTimeout(function() {
        time(o)
    },
    1000)
}
//点击获取验证码
document.getElementById("snscode").onclick=function(){
    var moblie = $('#Phone').val();
    if(moblie == ''){
        alert('手机号不能为空！');
        return false;
    }
    if(!(/^1[3|4|5|8|7][0-9]\d{8}$/.test(moblie))){ 
        alert("手机号码格式不正确");  
        return false; 
    }
    setCookie("time",wait,wait);
    time(this);
}

//js设置Cookie
function setCookie(name,value,time)
{
    var exp = new Date();
    exp.setTime(exp.getTime() + time * 1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
//js获取Cookie
function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
 
    if(arr=document.cookie.match(reg))
        return (arr[2]);
    else
        return null;
}

	$(function(){


		$('#form').ajaxForm({
			dataType:'json',		
			beforeSubmit:function(data, obj, es){
				tips = dialog({
					fixed: true,
					cancelDisplay: false
				});					
				if(LOCK){
					tips.title('还有正在提交的');
					tips.showModal();
					return false;
				}else{
					LOCK = true;
					tips.title('正在提交');
					tips.showModal();
					return true;
				}			
			},
			success:function(data){
				LOCK = false;
				if(data.status){
					tips.title('提交成功');
					if(data.url){
						window.location.href = data.url;					
					}
				}else{
					tips.title('提交失败');
					tips.content(data.info);
				}
			}
		});

		$("table input").click(function() {
			$("table input").css({
				"border" : "none"
			});
			$(this).css({
				"border" : "1px solid #ff97ae"
			});
		});
	});
	
</script>
